package com.laikan.reader.bookstore.activity;

import android.view.KeyEvent;
import android.view.View;
import android.widget.Toast;
import com.laikan.reader.R;
import com.laikan.reader.bookstore.base.BasicWebViewActivity;
import com.laikan.reader.comment.APIProtocol;

/**
 * Created by Administrator on 2016/10/18.
 */
public class BookStoreActivity extends BasicWebViewActivity {
    private String mUrl = APIProtocol.laikan_book_store_home;
    private long mkeyTime;

    @Override
    protected void assignViews() {
        super.assignViews();
        iv_back.setVisibility(View.GONE);
    }

    @Override
    protected void initData() {
        super.initData();
        super.setPageLoadData(R.string.home_bookstore,mUrl);
    }


    @Override
    protected void setListener() {
        super.setListener();
    }

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        // 2秒内连续按两次 退出程序
        if (keyCode == KeyEvent.KEYCODE_BACK) {
            if ((System.currentTimeMillis() - mkeyTime) > 2000) {
                mkeyTime = System.currentTimeMillis();
                Toast.makeText(this, R.string.personal_exit_program, Toast.LENGTH_SHORT).show();
            }else {
                finish();
            }
            return true;
        }
        return super.onKeyDown(keyCode, event);
    }

    @Override
    protected void onResume() {
        super.onResume();
    }
}
